<template>
  <header class="header">
      <h1>todos</h1>
      <input class="new-todo"  placeholder="请输入任务名称" autofocus v-model="value" @keyup.enter="fn"/>
    </header>
</template>

<script>
export default {
  data() {
    return {
      value:''
    }
  },
  methods: {
    fn(value) {
      if(this.value=='')return alert('error') 
      this.$emit('getlist', this.value)
      this.value=""
    // console.log(1);
  }
 }
}
</script>

<style>

</style>